package com.szrt.day20170411.ch04;


public class Person {
	
	
	/**
	 * 身份证
	 */
	private String idCard;
	private String name;
	private int  age;
	private char sex;
	
	

	/**
	 * 一旦有带参的构造方法。不会自动生成无参的构造方法
	 * @param idCard
	 * @param name
	 * @param age
	 * @param sex
	 */
	public Person(String idCard, String name) {
		
		System.out.println("进入方法");
		this.idCard = idCard;
		this.name = name;
	}
	
	
	public Person(int age, char sex) {
		this.age = age;
		this.sex = sex;
	}
	
	public Person(String idCard, String name, int age, char sex) {
		/*this.idCard = idCard;
		this.name = name;*/
		
		this(idCard, name);
		this.age = age;
		
		//this(age, sex);
		
		this.sex = sex;
		
		/*return null;*/
	}
	
	
		

	public String getIdCard() {
		return idCard;
	}

	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public char getSex() {
		return sex;
	}

	public void setSex(char sex) {
		this.sex = sex;
	}
	
	
	/**
	 * 学习方法
	 * @param something
	 */
	public void learn(String something){
		System.out.println(this.name+"开始学习"+something);
	}
	
	/**
	 * 工作的方法
	 */
	public void work(){
		System.out.println("开始工作");
	}
	
	public String info() {
		return "Person [idCard=" + idCard + ", name=" + name + ", age=" + age + ", sex=" + sex + "]";
	}
	
	
	/**
	 * 求和
	 * @param x
	 * @param y
	 * @return
	 */
	public int add2(int x ,int y){
		return x+y;
	}
	
	
	public int  add3(int a,int b, int c) {
		
		int sum = /*this.*/add2(a, b)+c;
		return sum;
	}
	
	
	
	
	

}
